﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class GiftsController
    {
        public int InsertGifts(GiftsInfo info)
        {
            return SQL.InsertGifts(info.GiftsCode, info.GiftsName, info.GiftsTypeId, info.GiftsPriceAdult, info.GiftsPriceChild, info.GiftsPriceBaby, info.QuantityAdult, info.QuantityChild, info.QuantityBaby, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate);
        }
        public void UpdateGifts(GiftsInfo info)
        {
            SQL.UpdateGifts(info.GiftsCode, info.GiftsName, info.GiftsTypeId, info.GiftsPriceAdult, info.GiftsPriceChild, info.GiftsPriceBaby, info.QuantityAdult, info.QuantityChild, info.QuantityBaby, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.GiftsId);
        }
        public void DeleteGifts(GiftsInfo info)
        {
            DeleteGifts(info.GiftsId);
        }
        public void DeleteGifts(int giftsId)
        {
            SQL.DeleteGifts(giftsId);
        }
        public GiftsInfo GetGifts(int giftsId)
        {
            return CBO.FillObject<GiftsInfo>(SQL.GetGifts(giftsId));
        }
        public List<GiftsInfo> ListGifts()
        {
            return CBO.FillCollection<GiftsInfo>(SQL.ListGifts());
        }

        public List<GiftsInfo> ListGiftsByGiftsType(int giftsTypeId)
        {
            return ListGifts().Where(p => p.GiftsTypeId == giftsTypeId).ToList();
        }
        public DataTable SelectGifts()
        {
            return CBO.ConvertToDataTable(ListGifts(), typeof(GiftsInfo));
        }
        public Dictionary<object, object> ListGiftsLookup()
        {
            var users = ListGifts();
            var dicusers = new Dictionary<object, object>();
            foreach (GiftsInfo info in users)
                dicusers.Add(info.GiftsId, info.GiftsName);

            return dicusers;
        }
    }
}
